package bam;


public class SavingsAccount extends Account{

    public SavingsAccount() {
        super();
    }

    public SavingsAccount(final int id, final String password, final String name,final String personId, final String email, final double balance) {
    	super(id, password, name, personId, email, balance);
    }

    public void withdraw(double a)throws NotEnoughBalanceException  {
        if(a>this.getBalance())
            throw(new NotEnoughBalanceException());
       this.setBalance(this.getBalance()-a);
    }


	@Override
	public boolean equals(Account x){
	    if(x != null && x instanceof SavingsAccount){
	        return true;
	    }
	    return false;
	}


	@Override
    public String toString() {
        return "SavingsAccount: Current balance is " +this.getBalance();
    }


}
